package Eyjafjalla.card.dolly;

import Eyjafjalla.card.AbstractEyjafjallaCard;
import Eyjafjalla.modcore.ColorEnum;
import com.megacrit.cardcrawl.actions.common.ApplyPowerAction;
import com.megacrit.cardcrawl.actions.common.GainBlockAction;
import com.megacrit.cardcrawl.cards.AbstractCard;
import com.megacrit.cardcrawl.characters.AbstractPlayer;
import com.megacrit.cardcrawl.core.CardCrawlGame;
import com.megacrit.cardcrawl.dungeons.AbstractDungeon;
import com.megacrit.cardcrawl.localization.CardStrings;
import com.megacrit.cardcrawl.monsters.AbstractMonster;
import com.megacrit.cardcrawl.powers.FlameBarrierPower;
import com.megacrit.cardcrawl.powers.WeakPower;

import java.util.Iterator;

public class LLH_Eyjafjalla extends AbstractEyjafjallaCard {
    public static final String ID = "LLH_Eyjafjalla";
    private static final CardStrings cardStrings;

    public LLH_Eyjafjalla(){
        super(ID, cardStrings.NAME,1,cardStrings.DESCRIPTION,CardType.SKILL, ColorEnum.Eyjafjalla_Dolly_COLOR,CardRarity.COMMON,CardTarget.ENEMY);
        setDolly();
        this.baseBlock = 6;
        this.block = 6;
        setFireDescription(cardStrings.EXTENDED_DESCRIPTION[0]);
    }

    @Override
    public AbstractCard makeCopy() {
        return new LLH_Eyjafjalla();
    }

    @Override
    public void use(AbstractPlayer p, AbstractMonster m) {
        addToBot(new GainBlockAction(p,block));
        if(!isFire()){
            this.addToBot(new ApplyPowerAction(m, p, new WeakPower(m, 2,false), 2));
        }
        else {
            for (AbstractMonster mm : AbstractDungeon.getMonsters().monsters) {
                if (!mm.isDeadOrEscaped()) {
                    this.addToBot(new ApplyPowerAction(mm, p, new WeakPower(mm, 2, false), 2));
                }
            }
        }
    }

    @Override
    public void upgrade() {
        if(!this.upgraded){
            upgradeName();
            upgradeBlock(4);
        }
    }

    static {
        cardStrings = CardCrawlGame.languagePack.getCardStrings(ID);
    }
}

